package com.haidechizi.designpattern.proxy.dynamic.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author haidechizi
 */
public class DynamicLog implements MethodInterceptor {

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("开始执行方法");
        Object result = methodProxy.invokeSuper(o, objects);
        System.out.println("方法执行结束");
        return result;
    }
}
